const scene = {
    state: {
        disasterAssessmentShow: false,
        disasterLocation: [], //地震地点
        drawPolygon: null,
        stationData: [],
        token: ""
    },
    getters: {
        getDrawPolygon(state) {
            if (!state.drawPolygon) {
                state.drawPolygon = JSON.parse(localStorage.getItem('drawPolygon'))
            }
            return state.drawPolygon
        },
        getStationData(state) {
            if (!state.stationData) {
                state.stationData = JSON.parse(localStorage.getItem('stationData'))
            }
            return state.stationData
        },
        getToken: function (state) {
            if (!state.token) {
                state.token = sessionStorage.getItem('token')
            }
            return state.token
        },
    },
    mutations: {
        SET_DRAWPOLYGON(state, data) {
            state.drawPolygon = data;
            localStorage.setItem("drawPolygon", JSON.stringify(state.drawPolygon))
        },
        SET_STATIONDATA(state, data) {
            state.stationData = data;
            localStorage.setItem("stationData", JSON.stringify(state.stationData))
        }
    }
}
export default scene
